import EnemyControl from "./EnemyControl";

const { ccclass, property } = cc._decorator;

@ccclass
export default class BulletControl extends cc.Component {
  @property(cc.Label)
  label: cc.Label = null;

  @property
  text: string = "hello";

  @property
  speed: number = 400;
  // LIFE-CYCLE CALLBACKS:

  // onLoad () {}

  start() {}

  update(dt) {
    this.node.y += this.speed * dt;
    if (this.node.y > 820) {
      this.node.destroy();
    }
  }
  onCollisionEnter(other) {
    //碰撞 如果碰到玩家 1让敌人死亡 2销毁自己，
    /**@tag
     * 1玩家子弹
     * 2敌机
     * 3敌方子弹
     * 4玩家
     */

    this.node.destroy();
  }
}
